<?php if ( ! defined('WDK_PATH')) exit('No direct script access allowed');?>
<!--{**************************************************************************}-->
<style>
.ckedit	{height:350px;}
.upload_files 				{padding:3px;}
.upload_files span.removed	{color:red;text-decoration: line-through;}
</style>
<!--{**************************************************************************}-->
<fieldset>
	<legend>게시글 정보</legend>
	<form id="editForm" action="" method="POST" enctype="multipart/form-data">
	<input type="hidden" name="bbs_seq" value="{bbs_seq}"/>
	<input type="hidden" name="post_seq" value="{data.post_seq}"/>
	<table class="form">
		<colgroup>
			<col style="width:15%;"/>
			<col style="width:35%;"/>
			<col style="width:15%;"/>
			<col style="width:35%;"/>
		</colgroup>
		<tbody>
			<tr>
				<th>제목 <em>*</em></th>
				<td colspan="3"><input type="text" name="post_title" value="{data.post_title}" class="input" style="width:98%;"/></td>
			</tr>
			<tr>
				<th>참조 Url</th>
				<td colspan="3"><input type="text" name="post_ref_url" value="{data.post_ref_url}" class="input" style="width:98%;"/></td>
			</tr>
			<!--{? bbs.bbs_category_flag == 'T' }-->
			<tr>
				<th>카테고리 <em>*</em></th>
				<td colspan="3">
					<!--{? bbs.categories }-->
					<select name="fk_category_seq">
						<!--{@ bbs.categories }-->
						<option value='{.category_seq}'<!--{? .category_seq == data.fk_category_seq}--> selected="selected"<!--{/}-->>{.category_name}</option>
						<!--{/}-->
					</select>
					<!--{:}-->
					생성된 카테고리가 없습니다. 
					<!--{/}-->
				</td>
			</tr>
			<!--{/}-->
			<tr>
				<th>옵션</th>
				<td colspan="3">
					<input type="hidden" name="post_notice_flag" value="F"/>
					<input type="checkbox" name="post_notice_flag" value="T" id="c1"<!--{? data.post_notice_flag == 'T'}--> checked="checked"<!--{/}-->/>
					<label for="c1">공지</label>
					<!--{? bbs.bbs_secure_flag == 'T' }-->
					<input type="hidden" name="post_secure_flag" value="F"/>
					<input type="checkbox" name="post_secure_flag" value="T" id="c2"<!--{? data.post_secure_flag == 'T'}--> checked="checked"<!--{/}-->/>
					<label for="c2">비밀글</label>
					<!--{/}-->
					<!--{? bbs.bbs_poll_flag == 'T' }-->
					<input type="hidden" name="post_poll_flag" value="F"/>
					<input type="checkbox" name="post_poll_flag" value="T" id="c3"<!--{? data.post_poll_flag == 'T'}--> checked="checked"<!--{/}-->/>
					<label for="c3">설문사용</label>
					<!--{/}-->
				</td>
			</tr>
			<!--{? bbs.bbs_poll_flag == 'T' }-->
			<tr id="post_poll_set" style="display:none;">
				<th>설문 설정</th>
				<td colspan="3">
					<input type="text" name="post_poll_title" value="{data.post_poll_title}" class="input" style="width:98%"/>
					<br/>
					1. <input type="text" name="post_poll_items[]" value="" class="input" style="width:30%"/>
					2. <input type="text" name="post_poll_items[]" value="" class="input" style="width:30%"/>
					3. <input type="text" name="post_poll_items[]" value="" class="input" style="width:30%"/>
					<br/>
					4. <input type="text" name="post_poll_items[]" value="" class="input" style="width:30%"/>
					5. <input type="text" name="post_poll_items[]" value="" class="input" style="width:30%"/>
					6. <input type="text" name="post_poll_items[]" value="" class="input" style="width:30%"/>
				</td>
			</tr>
			<!--{/}-->
			<!--{@ bbs.bbs_option_fields}-->
			<tr>
				<th>{.name}<!--{? .must == 'T'}--><em>*</em><!--{/}--></th>
				<td colspan="3">
				<!--{? .type : 'input'}-->
					<input type="text" name="post_option_field{.index_+1}" value="" class="input" style="width:98%;"/>
				<!--{:'radio'}-->
					<!--{@ .values_arr }-->
					<input type="radio" name="post_option_field{.index_+1}" value="{..value_}" id="r_{.index_}{..index_}"/>
					<label for="r_{.index_}{..index_}">{..value_}</label>
					<!--{/}-->
				<!--{:'checkbox'}-->
					<!--{@ .values_arr }-->
					<input type="checkbox" name="post_option_field{.index_+1}[]" value="{..value_}" id="c_{.index_}{..index_}"/>
					<label for="c_{.index_}{..index_}">{..value_}</label>
					<!--{/}-->
				<!--{/}-->
				</td>
			</tr>
			<!--{/}-->
			<!--{? data.post_seq > 0 && data.fk_user_seq == 0 }-->
			<tr>
				<th>사용자명</th>
				<td>
					<input type="text" name="post_user_name" value="{data.post_user_name}" class="input" size="20"/>
				</td>
				<th>이메일</th>
				<td>
					<input type="text" name="post_user_email" value="{data.post_user_email}" class="input" size="20"/>
				</td>
			</tr>
			<tr>
				<th>연락처</th>
				<td>
					<input type="text" name="post_user_mobile" value="{data.post_user_mobile}" class="input" size="20"/>
				</td>
				<th>비밀번호</th>
				<td>
					<input type="text" name="post_user_passwd" value="{data.post_user_passwd}" class="input" size="20"/>
				</td>
			</tr>
			<!--{/}-->
			<tr>
				<th>내용 <em>*</em></th>
				<td colspan="3">
					<textarea name="post_content" id="post_content" class="ckedit">{data.post_content}</textarea>
				</td>
			</tr>
			<!--{? bbs.bbs_tag_flag == 'T' }-->
			<tr>
				<th>태그</th>
				<td colspan="3">
					<input type="text" name="post_tag" value="{data.post_tag}" class="input" style="width:98%"/>
				</td>
			</tr>
			<!--{/}-->
			<!--{? bbs.bbs_file_flag == 'T' }-->
			<tr>
				<th>첨부파일</th>
				<td colspan="3">
					<!--{@ data.post_files }-->
					<div class="upload_files">
						<input type="file" name="post_file[]" class="input" size="30" disabled="disabled"/>
					 	<span>{.name} ( {.size})</span> 
						<input type="checkbox" name="remove_post_file[]" value="{.index_}" id="c{.index_}" class="remove_file"/>
						<label for="c{.index_}">삭제</label>
					</div>
					<!--{/}-->
					<!--{? count(data.post_files) < bbs.bbs_file_num }-->
					<!--{@ range(count(data.post_files), bbs.bbs_file_num-1) }-->
					<div class="upload_files">
						<input type="file" name="post_file[]" class="input" size="30"/>
					</div>
					<!--{/}-->
					<!--{/}-->
				</td>
			</tr>
			<!--{/}-->
		</tbody>
	</table>
	</form>
</fieldset>
{# plugin ckeditor #}
<!--{**************************************************************************}-->
<script>
(function($){
	$('#btn_save').click(function(){
		saveForm('#editForm');
	});
	$('.remove_file').click(function(){
		if(this.checked)
		{
			$(this).closest('div').children('span').addClass('removed');
			$(this).closest('div').children(':file').removeAttr('disabled');
		}
		else
		{
			$(this).closest('div').children('span').removeClass('removed');
			$(this).closest('div').children(':file').attr('disabled','disabled');
		}
	});
	$(':checkbox[name=post_poll_flag]').click(function(){
		if(this.checked)
		{
			$('#post_poll_set').show();
		}
		else
		{
			$('#post_poll_set').hide();
		}
	});
	$(document).ready(function(){
	});
})(jQuery);
</script>
<!--{**************************************************************************}-->